Sharepoint 2013 - Remove "Recent" from left menu

Hello All -

My client has requested that she be able to remove (or hide) the "Recent" menu header from the left menu in Sharepoint 2013. This is for specified site collections/sites/pages, not farm-wide.

So far, I've tried to do this via JQuery by adding the following code

<script type="text/javascript">
jQuery(document).ready(function() {
 jQuery(".ms-core-listMenu-item:contains('Recent')").parent().hide();
});
</script>

via both a script web-part and via a content editor web-part (using embed code), but to no avail. I've also tried adding the code above to a .js file (without the script tags) and calling it as

<script type="text/javascript" src="/_layouts/15/menu.remove.recent.js"></script>

instead, but it still doesn't work.

I've checked the page source and I can see the script is included. The "Recent" menu item however, is still there. My prefered solution would be to hide the menu item rather than remove it - I suspect removing it will probably cause issues as Sharepoint likely expects it to be there.

There's no requirement to use JQuery - it just seemed to me to be the best way. I would also rather not edit master pages unless there's no other choice.

Any

September 5th, 2013 7:27pm

Hi xida,

You need to reference the JQuery library, then add the code in the Content Editor Web Part in the view page (e.g. AllItems.aspx) of the Pages library, then the "Recent section" will be hidden when you access this AllItems.aspx page.

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

<script type="text/javascript">
jQuery(document).ready(function() {
  jQuery(".ms-core-listMenu-item:contains('Recent')").parent().hide();
});
</script>

Thanks

Free Windows Admin Tool Kit Click here and download it now
September 11th, 2013 6:01am

If its specific site collection why don't go to site settings >> navigation settings and remove the "Recent" heading and its links.

Am I missing something?

 
September 11th, 2013 6:34am

Hi -

Thanks for the replies, sorry about my late response

@Daniel - Thanks, I'll look in to this. However - the client wasn't aware that the 'Recent' menu was individual to each user, she wanted it removed as the thought everyone could see her recent documents. Once this was explained, she was happy to have the recent items remain on the menu. I will try out your suggestion in my DEV environment though, but at a later time.

@Rajesh - Thanks - The issue here is that it's dynamic and will reappear. It seems the only real way to get rid of it is to hide it via a script (as above).

Free Windows Admin Tool Kit Click here and download it now
September 18th, 2013 11:44am

If you want to remove it for good, create an event receiver which fires when list is added to site, then just update the navigation by deleting the "recent" item.

public override void ListAdded(SPListEventProperties properties)
{
	base.ListAdded(properties);

	SPWeb web = properties.Web;
	if (web != null)
	{
		var title = SPUtility.GetLocalizedString("$Resources:core,category_Recent", null, web.Language);
		SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
		foreach (SPNavigationNode node in nodes)
		{
			if (node.Title.ToLower().Equals(title.ToLower()))
			{
				node.Delete();
				break;
			}
		}
	}
}


  • Proposed as answer by Ahmad 2013 Tuesday, August 26, 2014 9:08 AM
November 12th, 2013 6:45am

If you want to remove it for good, create an event receiver which fires when list is added to site, then just update the navigation by deleting the "recent" item.

public override void ListAdded(SPListEventProperties properties)
{
	base.ListAdded(properties);

	SPWeb web = properties.Web;
	if (web != null)
	{
		var title = SPUtility.GetLocalizedString("$Resources:core,category_Recent", null, web.Language);
		SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
		foreach (SPNavigationNode node in nodes)
		{
			if (node.Title.ToLower().Equals(title.ToLower()))
			{
				node.Delete();
				break;
			}
		}
	}
}


  • Proposed as answer by Ahmad 2013 Tuesday, August 26, 2014 9:08 AM
Free Windows Admin Tool Kit Click here and download it now
November 12th, 2013 6:45am

If you want to remove it for good, create an event receiver which fires when list is added to site, then just update the navigation by deleting the "recent" item.

public override void ListAdded(SPListEventProperties properties)
{
	base.ListAdded(properties);

	SPWeb web = properties.Web;
	if (web != null)
	{
		var title = SPUtility.GetLocalizedString("$Resources:core,category_Recent", null, web.Language);
		SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
		foreach (SPNavigationNode node in nodes)
		{
			if (node.Title.ToLower().Equals(title.ToLower()))
			{
				node.Delete();
				break;
			}
		}
	}
}


November 12th, 2013 9:45am

This would be excellent but Recent does not display on the navigation settings.
Free Windows Admin Tool Kit Click here and download it now
January 14th, 2014 4:21am

This script worked for me for removing the "Recent" headings and the nodes under it in the Left navigation :

$FindString = "Recent"
Get-SPWebApplication "http://SharePointWeb" | Get-SPSite -Limit ALL | Get-SPWeb -Limit ALL | ForEach-Object {
$web = $_;
write-host $web.Navigation.QuickLaunch.Count;
for ($i = $web.Navigation.QuickLaunch.Count-1; $i -ge 0; $i--)
{
$node = $web.Navigation.QuickLaunch[$i];
if($node.Title -eq $FindString){
$node.Delete();
write-host $node.Title;
}
}
}

April 9th, 2014 7:21pm

No, you aren't missing something, MICROSOFT is missing something. You can delete the menu item all you want, but it will come back. Microsoft, as usual, has decided that you MUST have this feature. It would be nice to just have a checkbox somewhere to turn it on or off. But no, they decided you need to have this, and you have to write scripting to hide it.

When will Microsoft realize that we would like to have the power to customize our sites, and stop making us jump through hoops to get around their default designs? Just because you think it's a good idea, doesn't mean you should carve it in stone.

Free Windows Admin Tool Kit Click here and download it now
May 28th, 2014 12:24pm

The way i got around this is to Create a Group that has no members in it.

Then simply set Target Audience on the Recent folder to the Group you just created.

  • Proposed as answer by Andrew Stokes Friday, August 29, 2014 2:45 PM
August 4th, 2014 12:21am

The way i got around this is to Create a Group that has no members in it.

Then simply set Target Audience on the Recent folder to the Group you just created.

  • Proposed as answer by Andrew Stokes Friday, August 29, 2014 2:45 PM
Free Windows Admin Tool Kit Click here and download it now
August 4th, 2014 12:21am

Thanks Dario that's a neat work around.  It did the trick for me :)
August 29th, 2014 2:45pm

Thanks Dario that's a neat work around.  It did the trick for me :)
Free Windows Admin Tool Kit Click here and download it now
August 29th, 2014 2:45pm

Excellent ! 

Thanks for a clean and quick workaround !


September 20th, 2014 3:16am

Perfect Dario. Short and sweet and no custom code. Thank you. 
Free Windows Admin Tool Kit Click here and download it now
October 7th, 2014 1:55pm

Thanks Dario! That was so easy and worked perfectly.
January 4th, 2015 12:32pm

Dario, can you give some detail on how you get to these folders?  I can't seem to locate the folders so that I can turn on audience targeting.  Can you get there using the regular Admin tools?
  • Edited by Covert Rain Thursday, January 22, 2015 4:05 PM
Free Windows Admin Tool Kit Click here and download it now
January 22nd, 2015 4:04pm

Dario, can you give some detail on how you get to these folders?  I can't seem to locate the folders so that I can turn on audience targeting.  Can you get there using the regular Admin tools?
  • Edited by Covert Rain Thursday, January 22, 2015 4:05 PM
January 22nd, 2015 4:04pm

Brilliant idea! Thank you SO much!

We don't have access to master pages on our SharePoint collection, so this was the perfect workaround.

Free Windows Admin Tool Kit Click here and download it now
February 3rd, 2015 10:00pm

Site Settings > Look and Feel > Navigation > Structural Navigation

April 30th, 2015 8:08pm

Is there anyway to the emptygroup thing for the entire site? It seems I have to do it for every subsite.

Free Windows Admin Tool Kit Click here and download it now
May 4th, 2015 4:27pm

That was an awesome workaround!
June 19th, 2015 3:02pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics